---
title: Serializer
excerpt: Using a custom serializer with DrupalClient.
---

The `NextDrupalPages` uses [jsona](https://github.com/olosegres/jsona) as the default serializer for serializing and deserializing JSON:API data.

You can provide your own using the [`serializer`](/docs/client/configuration#serializer) option.

---

## Example

Here's how you can replace the default serializer with [jsonapi-serializer](https://github.com/SeyZ/jsonapi-serializer).

```ts title=lib/drupal.ts
import { NextDrupalPages } from "next-drupal"
import { Deserializer } from "jsonapi-serializer"

// Create a custom serializer.
const customSerializer = new Deserializer({
  keyForAttribute: "camelCase",
})

// Pass the custom serializer to the client.
export const drupal = new NextDrupalPages(
  process.env.NEXT_PUBLIC_DRUPAL_BASE_URL,
  {
    serializer: customSerializer,
  }
)
```
